﻿Imports System
Imports System.Drawing
Imports System.Windows.Forms

Namespace System.Workflow.ComponentModel.Design
    Public Class WorkflowViewAccessibleObject
        Inherits ControlAccessibleObject
        ' Methods
        Public Sub New(ByVal workflowView As WorkflowView)
            MyBase.New(workflowView)
            If (workflowView Is Nothing) Then
                Throw New ArgumentNullException("workflowView")
            End If
            Me.workflowView = workflowView
        End Sub

        Public Overrides Function GetChild(ByVal index As Integer) As AccessibleObject
            If ((Not Me.workflowView.RootDesigner Is Nothing) AndAlso (index = 0)) Then
                Return Me.workflowView.RootDesigner.AccessibilityObject
            End If
            Return MyBase.GetChild(index)
        End Function

        Public Overrides Function GetChildCount() As Integer
            If (Me.workflowView.RootDesigner Is Nothing) Then
                Return -1
            End If
            Return 1
        End Function

        Public Overrides Function Navigate(ByVal navdir As AccessibleNavigation) As AccessibleObject
            If ((navdir <> AccessibleNavigation.FirstChild) AndAlso (navdir <> AccessibleNavigation.LastChild)) Then
                Return MyBase.Navigate(navdir)
            End If
            Return Me.GetChild(0)
        End Function


        ' Properties
        Public Overrides ReadOnly Property Bounds As Rectangle
            Get
                Return New Rectangle(Me.workflowView.PointToScreen(Point.Empty), Me.workflowView.ViewPortSize)
            End Get
        End Property

        Public Overrides ReadOnly Property DefaultAction As String
            Get
                Return DR.GetString("AccessibleAction", New Object(0  - 1) {})
            End Get
        End Property

        Public Overrides ReadOnly Property Description As String
            Get
                Return DR.GetString("WorkflowViewAccessibleDescription", New Object(0  - 1) {})
            End Get
        End Property

        Public Overrides ReadOnly Property Help As String
            Get
                Return DR.GetString("WorkflowViewAccessibleHelp", New Object(0  - 1) {})
            End Get
        End Property

        Public Overrides Property Name As String
            Get
                Return DR.GetString("WorkflowViewAccessibleName", New Object(0  - 1) {})
            End Get
            Set(ByVal value As String)
            End Set
        End Property

        Public Overrides ReadOnly Property Role As AccessibleRole
            Get
                Return AccessibleRole.Diagram
            End Get
        End Property


        ' Fields
        Private workflowView As WorkflowView
    End Class
End Namespace

